<!DOCTYPE HTML>
<html>
<head>
    {include file="common:meta"}
</head>
<body>

<div class="page-container">
    <div class="float-e-margins">
        <div class="ibox-content">
            <div class="tabs-container">
                <form method="get" class="form-horizontal" id="form" action="">
                    <div class="hr-line-dashed"></div>
                    <div class="form-group has-success">
                        <label class="col-sm-2 control-label">*用户UID</label>
                        <div class="col-sm-10">
                            <input type="number" name="u_id" value="" class="form-control">
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group has-success">
                        <label class="col-sm-2 control-label">*自定义天数</label>
                        <div class="col-sm-10">
                            <input type="number" name="day" value="" class="form-control">
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group has-success">
                        <div class="col-sm-4 col-sm-offset-2">
                            <input class="btn btn-primary" id="btn-submit" type="button" value="提交">
                        </div>
                        <input type="hidden"  name='vehicle_id' value="{$vehicle_id}">
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{include file="common:footer"}

<script>

    //同意修改
    var index = parent.layer.getFrameIndex(window.name);
    $('#btn-submit').click(function(){
        layer.confirm('确定添加该用户？',{
            title:['提示','font-size:18px;font-family:楷体;font-weight:700;'],
            btn: ['确定','取消'] //按钮
        },function(){
            $.ajax({
                type:'get',
                url:'/VehicleAddUser',
                async:true,
                data:$('#form').serialize(),
                dataType:'json',
                success:function(result){
                    console.log(result);
                    if(result.code === 100){
                        layer.msg(result.msg,{
                            icon:1,
                            time:1000
                        });
                        setTimeout(function () {
                            parent.layer.close(index);// 关闭layer
                        },1500);

                    }
                    else{
                        layer.msg(result.msg,{
                            icon:2,
                            time:1000
                        });
                    }
                },
                error:function(err){
                    layer.msg('服务器开小差了！',{
                        time:1500
                    });
                }
            });
        });
    });
</script>
</body>
</html>